<template>
	<view class="create-classrule">
		<slot name="action">
			<movable-area class="movable-area" v-if="showAction">
				<movable-view x="600rpx" y="1124rpx" class="movable-view" direction="all">
					<view class="plus" @tap="teachingTypeOpen">
						<u-icon name="plus" size="36rpx" bold color="#ffffff"></u-icon>
					</view>
				</movable-view>
			</movable-area>
		</slot>
		<u-popup round="16rpx" :show="teachingTypeShow" @close="teachingTypeClose">
			<view class="teaching-title">授课模式选择</view>
			<view class="teaching">
				<view class="teaching-type" v-for="(item, index) in teachingType" :key="index" @tap="$onBlock">
					<cc-classtime-icon :value="item" type="logo" />
					<span class="teaching-type-title">{{ item.classTime }}</span>
					<span class="teaching-type-desc">{{ item.classTimeDesc }}</span>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import {
		teachingType
	} from '@/codecat/config/index';
	export default {
		props: {
			showAction: {
				type: Boolean,
				default: true
			}
		},
		data() {
			return {
				teachingType,
				teachingTypeShow: false,
				cla_id: null
			};
		},
		methods: {
			teachingTypeOpen() {
				this.teachingTypeShow = true;
			},
			teachingTypeClose() {
				this.teachingTypeShow = false;
			},
		}
	};
</script>

<style lang="scss" scoped>
	.movable-area {
		height: 100vh;
		width: 100vw;
		top: 0;
		z-index: 2;
		position: fixed;
		pointer-events: none; //鼠标事件可以渗透
	}

	.movable-view {
		width: 88rpx; // 按钮大小
		height: 88rpx;
		pointer-events: auto; //恢复鼠标事件

		.plus {
			@include center;
			border-radius: 50%;
			background: $u-primary;
			width: 88rpx;
			height: 88rpx;
		}
	}

	.create-classrule {
		.teaching-title {
			@include center;
			font-weight: 500;
			font-size: 32rpx;
			height: 108rpx;
			padding: 0 32rpx;
			border-bottom: 2rpx solid $u-border-color;
		}

		.teaching {
			display: flex;

			&-type {
				flex: 1;
				cursor: pointer;
				display: flex;
				flex-direction: column;
				align-items: center;
				padding: 64rpx 0 44rpx;

				&-title {
					margin-top: 8rpx;
					color: #111111;
					font-size: 32rpx;
				}

				&-desc {
					color: $u-tips-color;
					margin-top: 8rpx;
				}
			}
		}
	}
</style>